
import java.io.*;

import errors.TypingError;

import typage.Typing;
import java_cup.runtime.*;
import ast.*;

/* we extend the (CUP-generated) parser class to print nicer
   error messages */
class myparser extends parser {

    String filename;

    myparser(Scanner s, String f) { super(s); filename = f; }

    public void syntax_error(Symbol cur_token) {
	if (cur_token.sym == sym.EOF)
	    System.out.println("Syntax error: unexpected end of file");
	else {
	    System.out.println("File \"" + filename + "\"" +
			       ", line " + cur_token.left + 
			       ", character " + cur_token.right + ":");
	    System.out.println("syntax error");
	}
	System.exit(1);
    }
}